<?php

    class CustomControllerAction extends Zend_Controller_Action
    {

       public $messenger;
       public $logger;
	
       public function init()
       {
          $this->messenger = $this->_helper->getHelper('FlashMessenger');
		  $this->logger = Zend_Registry::get('logger');

          //можно и так написать, но первый вариант, на мой взгляд, более изящный
          //$this->messenger = $this->_helper->_flashMessenger;
       }

      public function preDispatch()
      {
      }

      public function postDispatch()
      {
          $this->view->messages = $this->messenger->getMessages();
      }
      
      protected function sendJson($data)
      {
    	$this->_helper->viewRenderer->setNoRender();
    	$this->getResponse()->setHeader('content-type','application/json');
    	echo Zend_Json::encode($data);
      }

    }

?>
